export const request = (params) => {
  // 请求数据之前的加载框
  wx.showLoading({
    title: "加载中...",
    mask: true,
  });
  // 公共请求地址
  const baseUrl = "http://localhost:3000";

  return new Promise((resolve, reject) => {
    wx.request({
      ...params,
      url: baseUrl + params.url,
      success: (result) => {
        resolve(result);
      },
      fail: (err) => {
        reject(err);
      },
      complete: () => {
        wx.hideLoading();
      },
    });
  });
};
